<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://unpkg.com/vue@next"></script>
    <div id="app">
        <todo-item v-model.capitalize="bar"></todo-item>
    </div>
    <script>
        const vueOpt = {
            data(){
                return {
                    bar: "kenny.bai"
                }
            },

            created(){
                setInterval(()=>{
                    console.log('bar:', this.bar);
                }, 1000);
            }
        }

        const app = Vue.createApp(vueOpt);
        app.component('todo-item', {
            data(){
                return {
                    
                }
            },
            props:{
                // modelValue和modelModifiers都是vue内置的属性，取其它名字，只是一个普通props属性, 没有任何效果
                modelValue: String,
                // modelModifiers默认是一个空对象
                modelModifiers: {
                    default: () => ({})
                }
            },

            template: `
                <input type="text"
                    :value="modelValue"
                    @input="$emit('update:modelValue', $event.target.value)"
                >
            `,

            created(){
                console.log(this.modelModifiers1);
            }
        });

        app.mount('#app');
    </script>
</body>
</html>